package cn.wolfcode.crm.web.controller;/**
 * Created by 10797 on 2018/7/12.
 */

import cn.wolfcode.crm.domain.GuaranteeBill;
import cn.wolfcode.crm.query.GuaranteeBillQueryObject;
import cn.wolfcode.crm.service.IGuaranteeBillService;
import cn.wolfcode.crm.util.JsonResult;
import cn.wolfcode.crm.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @program: crm
 * @description: 提审表单的控制组件,该控件只是为了实现页面效果又为了区分跟暂存单的区别避免在保单组件当中
 * 内容过多而设置的一个控件类
 * @author: Mr.chen
 * @create: 2018-07-12 21:40
 **/
@Controller
@RequestMapping("receiptBill")
public class ReceiptBillController {

    @Autowired
    private IGuaranteeBillService receiptBillService;

    //跳转到退回单页面
    @RequestMapping("")
    public String list(){
        return "/receiptBill/list";
    }

    //保存当前暂存单的状态
    @RequestMapping("changeStateUnaudited")
    @ResponseBody
    public JsonResult changeStateUnaudited(Long id) {
        try {
            receiptBillService.changeStateUnaudited(id);
        } catch (Exception e) {
            e.printStackTrace();
            return new JsonResult("提审失败");
        }
        return new JsonResult();
    }

    //查询当期退回修改单的数据
    @RequestMapping("query")
    @ResponseBody
    public PageResult query(GuaranteeBillQueryObject qo){

        return receiptBillService.query(qo);
    }

    /*
    * 查询修改意见的方法
    * */
    @RequestMapping("queryInfo")
    @ResponseBody
    public GuaranteeBill queryInfo(Long id){

        return receiptBillService.queryInfo(id);
    }



}
